//
//  Controller.h
//  snomPhone
//
//  Created by Daniel Hazelbaker on 10/22/08.
//  Copyright 2008 Blue Box Moon. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import "HTTPServer.h"


@class BMSnomPhone, BMPhoneStatus, BMPluginController;

@interface Controller : NSObject {
    IBOutlet NSWindow	*passwordWindow;

    BMSnomPhone		*snomPhone;
    BMPhoneStatus	*phoneStatus;
    NSConnection	*phoneConnectionServer;
    HTTPServer		*phoneHttpServer;
    BMPluginController	*pluginController;

    NSMutableDictionary	*currentCalls;
    
    NSTimer		*phoneTimer;
    NSCalendarDate	*lastMenuAccess;
    NSDictionary	*lastCallHistory;

    NSString		*phoneAddress, *phonePassword;
}

- (NSString *)findPhoneIPAddress;
- (NSString *)primaryLocalAddress;
- (NSString *)urlencode:(NSString *)url;

- (void)rootMenuNeedsUpdate:(NSMenu *)menu;
- (void)historyMenuNeedsUpdate:(NSMenu *)menu;

- (IBAction)savePassword:(id)sender;

- (void)processIncomingCall:(NSDictionary *)parameters;
- (void)processOutgoingCall:(NSDictionary *)parameters;
- (void)processConnectedCall:(NSDictionary *)parameters;
- (void)processDisconnectedCall:(NSDictionary *)parameters;

@end

